﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class CheckResult : IComparable
    {
        public int max { get; set; }
        public int secmax { get; set; }
        public int thirmax { get; set; }
        public int fourmax { get; set; }
        public int fifmax { get; set; }
        public CardTypes cardType { get; set; }
        public FollowCardsTypes valueType { get; set; }

        public int CompareTo(object obj)
        {
            CheckResult other = obj as CheckResult;

            if (other == null)
                throw new Exception("比较对象类型非法！");

            if (valueType == other.valueType)
            {
                if (max == other.max)
                {
                    if (secmax == other.secmax)
                    {
                        if (thirmax == other.thirmax)
                        {
                            if (fourmax == other.fourmax)
                            {
                                return fifmax.CompareTo(fifmax);
                            }
                            else
                            {
                                return fourmax.CompareTo(fourmax);
                            }
                        }
                        else
                        {
                            return thirmax.CompareTo(thirmax);
                        }
                    }
                    else
                    {
                        return secmax.CompareTo(secmax);
                    }
                }
                else
                {
                    return max.CompareTo(other.max);
                }
            }

            return valueType.CompareTo(other.valueType);

        }
    }
}
